package cn.xfdzx.android.apps.shop.adapter;

import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.ArrayList;
import java.util.List;

import cn.xfdzx.android.apps.shop.R;
import cn.xfdzx.android.apps.shop.bean.GoodsLimitBean;

/**
 * Creator: zf.
 * Date: 2020/8/21.
 * Description:限购商品列表-头部横向适配器-下方指示器标签适配器.
 */
public class GoodsLimitListHead_TagAdapter extends BaseQuickAdapter<GoodsLimitBean.DataBean, BaseViewHolder> {
    //private AfterServiceGoodsListAdapter.OnItemOnClickListener onItemOnClickListener;
    private List<GoodsLimitBean.DataBean> dataBeans = new ArrayList<>();//商品列表

    public GoodsLimitListHead_TagAdapter(@Nullable List<GoodsLimitBean.DataBean> data) {
        super(R.layout.item_goodslimit_head_tag, data);
        this.dataBeans = data;
    }

    @Override
    public void setData(int index, @NonNull GoodsLimitBean.DataBean data) {
        super.setData(index, data);
    }


    @Override
    protected void convert(final BaseViewHolder viewHolder, final GoodsLimitBean.DataBean date) {
        TextView tv_tag = viewHolder.getView(R.id.tv_tag);

        if (date.isSel()){
            tv_tag.setBackgroundResource(R.color.color_FFFFFF);
        }else {
            tv_tag.setBackgroundResource(R.color.color_66c1a6f9);
        }
       // Glide.with(mContext).load(mList.get(position).getThumb()).apply(options.transform(mation)).into(holder.ivFineSelect);
    }
    public void clearDatas(){
        mData.clear();
        notifyDataSetChanged();
    }
    public void refreshDatas(List<GoodsLimitBean.DataBean> list){
        this.dataBeans = list;
        super.replaceData(list);
    }

    public void addDatas(List<GoodsLimitBean.DataBean>  list){
        super.addData(list);
        //mData.addAll(list);
    }


//    public interface OnItemOnClickListener {
//        void onItemAddMoveClick(int position,int count, OrderDetailInfoBeen.DataBean.CartInfoBean date);
//    }

}
